{% set pypi_name = 'aodhclient' %}
{% set upstream_version = upstream_version('2.1.1') %}
{% set rpm_release = '1' %}
{% set source = url_pypi() %}

Name:           {{ py2name(py_versions=['py3']) }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Summary:        Python client library for Aodh
License:        {{ license('Apache-2.0') }}
Group:          Development/Languages/Python
URL:            https://github.com/openstack/python-aodhclient
Source0:        {{ source }}
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('cliff') }}
BuildRequires:  {{ py3('keystoneauth1') }}
BuildRequires:  {{ py3('oslo.serialization') }}
BuildRequires:  {{ py3('oslo.utils') }}
BuildRequires:  {{ py3('oslotest') }}
BuildRequires:  {{ py3('osprofiler') }}
BuildRequires:  {{ py3('pbr') }}
BuildRequires:  {{ py3('pyparsing') }}
BuildRequires:  {{ py3('python-subunit') }}
BuildRequires:  {{ py3('requests') }}
BuildRequires:  {{ py3('stestr') }}
BuildRequires:  {{ py3('testtools') }}
Requires:       {{ py3('cliff') }}
Requires:       {{ py3('debtcollector') }}
Requires:       {{ py3('keystoneauth1') }}
Requires:       {{ py3('osc-lib') }}
Requires:       {{ py3('oslo.i18n') }}
Requires:       {{ py3('oslo.serialization') }}
Requires:       {{ py3('oslo.utils') }}
Requires:       {{ py3('pbr') }}
Requires:       {{ py3('pyparsing') }}
Requires:       {{ py3('six') }}
BuildArch:      noarch

%description
This is a client library for Aodh built on the Aodh API. It
provides a Python API (the aodhclient module) and a command-line tool.

%package doc
Summary:        Documentation for OpenStack Aodh API Client
Group:          Documentation/HTML
BuildRequires:  {{ py3('Sphinx') }}
BuildRequires:  {{ py3('openstackdocstheme') }}

%description      doc
This is a client library for Aodh built on the Aodh API. It
provides a Python API (the aodhclient module) and a command-line tool.

This package contains auto-generated documentation.

%prep
%autosetup -n {{ pypi_name }}-%{version}
%py_req_cleanup

%build
%py3_build

%install
%py3_install

PBR_VERSION=%{version} %sphinx_build -b html doc/source doc/build/html
# Fix hidden-file-or-dir warnings
rm -r doc/build/html/.{doctrees,buildinfo}

%check
# FIXME: only run unittests for now.
python3 -m stestr.cli --test-path  ./aodhclient/tests/unit run

%files
%doc README.rst
%license LICENSE
%{_bindir}/aodh
%{python3_sitelib}/aodhclient
%{python3_sitelib}/*.egg-info

%files doc
%doc doc/build/html
%license LICENSE

%changelog
